<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Features extends CI_Controller {
    
        public function newsletters() {
            $this->get('newsletters');
        }
        
        public function events() {
            $this->get('events');
        }

	public function get($type)
	{
            $data['type'] = $type;
            
            $this->load->library('session');
            $data['lang'] = $this->session->userdata('lang');
            $language_id = $this->session->userdata('language_id');
            if(empty($language_id)) $language_id = 1;

            $this->load->model('Multimedia_model');
            $multimedia = $this->Multimedia_model->multimedia_home_list();
            if(!empty($multimedia)) {
                $data['multimedia'] = $multimedia;
            }
            
            switch($type) {
                case 'newsletters': {
                    $this->load->model('Newsletter_model');
                    $data['features'] = $this->Newsletter_model->newsletters_list($language_id);
                } break;
                case 'events': {
                    $this->load->model('Event_model');
                    $data['features'] = $this->Event_model->events_list($language_id);
                } break;
            }
            
            $this->load->view('features/index', $data);
	}
        
}